home *** CD-ROM | disk | FTP | other *** search
- Path: phoenix.rhein.de!yaps!arno
- From: arno@yaps.rhein.de (Arno Eigenwillig)
- Newsgroups: comp.sys.amiga.programmer
- Subject: Re: Is this a SAS/C bug or have I coded it wrong?
- Message-ID: <+bWXx*6df@yaps.rhein.de>
- Date: Tue, 16 Jan 1996 17:35:58 +0100
- References: <4cfrc5$gsc@misery.millcomm.com> <1996Jan15.214611@clstac>
- Organization: Yet Another Private Site in Meckenheim, Germany
- X-Copyright: This article may not be distributed on a CD-ROM
- or in printed form without prior written consent of the author.
- X-Newsreader: Arn V 1.04
-
- In article <1996Jan15.214611@clstac>, cdubose@csupomona.edu writes:
-
- > if ( (tmpbuf[0] & 0x1f) == 1 )
-
- > That expression is equivalent to (tmpbuf[0] % 32 == 1).
-
- Only if tmpbuf[0] >= 0.
-
- ANSI requires that a == (a/b)*b + a%b. a%b > 0 is only required in
- case both a and b are non-negative. For the other cases (provided a%b
- != 0), it is up to the compiler vendor to define whether a/b shall
- round towards -inf and a%b shall be positive, or a/b shall round
- towards 0 and a%b shall be negative.
-
- ANDing with 2^n - 1 to compute MOD 2^n is common, but problematic if
- the left operand is signed, because this method always delivers
- positive results, whereas the m68k DIVS and hence % in straight-for-
- ward implementations delivers negative remainders for a < 0 < b.
-
- -- __
- __/// Arno Eigenwillig /\ <arno@yaps.rhein.de> \/ PGP key available.
- \XX/ V+49-2225-5870 /\ <Arnooo @ #amigager> \/ MIME 8bit welcome.
-